package com.ybf.api.entity;

import java.time.LocalDateTime;
import java.sql.Timestamp;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

/**
 * <p>
 *
 * </p>
 *
 * @author ybf
 * @since 2024-09-26
 */
@Data
public class FileDetails {

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private Integer id;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private String filename;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private String filepath;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private Integer filesize;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private String filetype;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private String hash;

    @Schema(name = "")
    private String description;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private Integer uploadedBy;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    private Integer createdBy;

    @Schema(name = "")
    @NotBlank(message = "不能为空")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp createdAt;

    @Schema(name = "")
    private Integer status;

    private Integer url;

    public String getUrl() {
        return this.filepath + "/" + this.hash + "." + this.filetype;
    }
}
